<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>填写与核对订单</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/order.ordersubmit.css">
    <script type="application/javascript" src="../js/jquery-3.3.1.js"></script>
    <script type="application/javascript" src="../js/bootstrap.min.js"></script>
    <script type="application/javascript" src="../layui/layui.js"></script>
    <script type="application/javascript" src="../js/vue.min.js"></script>
</head>
<body style="position: static">
<div id="app" class="bgGray">
    <div data-v-95ac8d30="" class="header3">
        <div data-v-95ac8d30="" class="layout clear">
            <div data-v-95ac8d30="" class="left logo">
                <a data-v-95ac8d30="" href="index.html">
                    <img data-v-95ac8d30="" src="">
                </a>
            </div>
            <div data-v-95ac8d30="" class="header3Nav right">|<a data-v-95ac8d30="" href="../mymain/mymain.html">我的订单</a>|<a data-v-95ac8d30="" href="helpCenter.html">帮助中心</a>|<a data-v-95ac8d30="" href="javascript:void">退出</a></div> <div data-v-95ac8d30="" class="header3User right"><i data-v-95ac8d30="" class="iconfont icon-phone"></i><span data-v-95ac8d30="" class="sp1">400-919-8000</span><span data-v-95ac8d30="" class="sp2">欢迎您，</span><span data-v-95ac8d30="" class="sp3"></span></div></div></div>




    <div class="checkOrderTit">
        <div class="layout">
            <div class="checkOrderTitCom">
                <div class="checkOrderTitComT">
                    <div class="td1 bgRed"></div>
                    <div class="td2 bgRed">1</div>
                    <div class="td3 bgRed"></div>
                    <div class="td2 bgRed">2</div>
                    <div class="td3 bgGray1"></div>
                    <div class="td2 bgGray1">3</div>
                    <div class="td1 bgGray1"></div>
                </div>
                <div class="checkOrderTitComB">
                    <div class="bd1 colorRed">选择车辆</div>
                    <div class="bd2 colorRed">填写和核对订单</div>
                    <div class="bd1 colorGray">提交成功</div>
                </div>
            </div>
        </div>
    </div>

    <div class="orderMsg clear">

        <div class="orderMsgs">
            <div class="orderMsgL left">
                <img :src="infos.picture">
                <p>{{infos.type}}|{{infos.sitnum}}座</p>

            </div>
            <div class="orderMsgR left">
                <div class="carTitle">
                    <span class="carTitle1 left">{{infos.name}}</span>
                </div>

                <div class="selCarMsg">
                    <div class="selCarMsgCom">
                        <div class="MsgTit">取车</div>
                        <div class="Msg">取车地址：{{getcitys.name}}</div>
                    </div>

                    <div class="selCarMsgCom">
                        <div class="MsgTit">还车</div>
                        <div class="Msg">还车地址：{{backcitys.name}}</div>
                    </div>
                </div>
            </div>
            <div class="costCom right">
                <h3>费用明细</h3>
                <div class="item">
                    <span class="left" >基本租金</span>
                    <span class="right">{{infos.price}}元</span>
                </div>
                <div class="item">
                    <span class="left" >手续费（35元/单）</span>
                    <span class="right">35元</span>
                </div>
                <div class="item">
                    <span class="left" >基本保障服务</span>
                    <span class="right">50元</span>
                </div>
                <div class="payMony">
                    <label class="right">应付金额&nbsp;
                        <span id="total">{{current()}}</span></label>
                </div>

                <button class="buttons right" id="butt" onclick="submitorder()">
                    提交订单
                </button>

            </div>



        </div>

    </div>
</div>


<script type="text/javascript">
    var vm = new Vue({
        el:'.orderMsgs',
        data:{
            infos:'',
            getcitys : '',
            backcitys: ''
        },

        methods:{
            current:function (){
                var total = 0;
                var money = 85;
                total = this.infos.price + money;
                return total;
            }
        }
    });



</script>


<script type="text/javascript">
    $(function(){
         var getid = window.location.search;//获取该页面的url地址
        //var getid = "?getId=1&backId=2"
        // alert(getid);

        $.ajax({
            type:"get",
            url:"/getCityById"+getid,
            dataType:"json",
            success:function(data){
                if(data.statusCode == 200) {
                    var infos = data.data;
                    // console.log(data);
                    vm.getcitys = data.data[0];
                    //alert(data.data[0].name);
                    vm.backcitys = data.data[1];
                }
            },
            error : function(){
                alert("没找到地址");
            }

        })
    })

</script>


<script type="text/javascript">
    $(function(){
        var getid = window.location.search;
        //var getid = "?id=1";
        // alert(getid);

        $.ajax({
            type:"get",
            //url:"/carsys/car/findcar.do"+getid,
            url:"/selectCarById"+getid,
            dataType:"json",
            success:function(data){
                // console.log(data);
                if(data.statusCode==200) {
                    vm.infos = data.data;
                    // alert(data.data);
                }
            },
            error : function(){
                alert("没查到车");
            }

        })
    })

</script>


<script type="text/javascript">

    function submitorder() {
        var id = window.location.search;//获取url？后面的地址
        //var id = "?cid=1&uid=2&getId=1&backId=2";
        var uid = window.sessionStorage.getItem("uid");
        var total = $("#total").html(); //获取价格
        $.ajax({
            type:"get",
            //url:"/carsys/order/add.do"+id + "&oprice="+ total,
            url:"/insertOrder"+id+"&oprice="+ total+"&uid="+uid,
            dataType:"json",
            success:function (data){
                // alert(data);
                window.location.href="/mymain?id="+id;
            },
            errors:function (){
                alert("ajax加载失败");
            }
            /*success:function(data){
                    alert(data.info);
                    window.location.href="../mymain/mymain.html";
            },
            error : function(){
                alert("ajax加载失败");
            }*/

        })
    }

</script>




</body>
</html>